package algorithms.concBT;

import algorithms.SearchProcess;
import general.CPA.CPA;
import general.constraints.VariableConstraints;
import general.currentdomain.ArrayCurrentDomain;
import general.currentdomain.CurrentDomain;
import general.messages.SplitMessage;
import ordering.VariableOrdering;

public class ConcBT1CPAAgent extends ConcBTAgent {

	public ConcBT1CPAAgent(byte id, byte n, byte domain, int split_limit,
			VariableConstraints constraints, VariableOrdering ordering,
			CPA protoCpa, int delay) {
		super(id, n, domain, split_limit, constraints, ordering, protoCpa, delay);
	}
	
	@Override
	protected void initializeSPs(){
		log("Initializing SPs", LOG_INIT);
		CPA firstCpa = getNewCPA(n, maxCPA++, id);					//creates new CPA for the first variable
		CurrentDomain firstDm = new ArrayCurrentDomain(domain);		//creates a domain for the first variable
		SearchProcess firstsp = new SearchProcess(firstCpa, domain, firstDm);	//creates the search process
		firstsp.setOrigin(firstsp);									//sets origin for the search process
		sps.put(firstsp.getId(), firstsp);							//insert the search process to the SP list
		numSPs++;
		curSPs++;
		assignCPA(firstCpa);
		maxSPs = Math.max(curSPs, maxSPs);
	}
	
	@Override
	public boolean handleMessage(SplitMessage message) {
		return false;
	}

}
